<?php if (!defined(‘BASEPATH’)) exit(‘No direct script access allowed’);

class SimpleAuth
{

  function SimpleAuth()
  {
    $this->ci =& get_instance();
    $this->ci->load->library(‘Session’);
    $username = $this->ci->session->userdata(‘username’);
    $password = $this->ci->session->userdata(‘password’);
    
    if($username && $password)
    {
      $this->ci->db->where(‘username’,$username);
      $this->ci->db->where(‘password’,$password);
      $query = $this->ci->db->get(‘auth’);

      if ($query->num_rows() < 0 )
      {
        header(“location: “.base_url().”index.php”);
      }
    }else{
      header(“location: “.base_url().”index.php”);
    }
  }
}
?>